from selenium.webdriver.common.by import By

from base import Base
class Page(Base):
    # 返回
    def fanhui(self):
        loc=(By.ACCESSIBILITY_ID,'返回')
    # 首页搜索
    def sousuo1(self):
        loc=(By.ANDROID_UIAUTOMATOR,'new UiSelector().text("搜商品名称 作者 出版社 ISBN")')
        ele=self.find_ele(loc)
        return ele
    # 搜索框
    def sousuo2(self):
        loc=(By.CLASS_NAME,'android.widget.EditText')
        ele=self.find_ele(loc)
        return ele
    # 搜索按钮
    def sousuoanniu(self):
        loc=(By.ID,'com.kongfz.app:id/tvSearch')
        ele=self.find_ele(loc)
        return ele
    # 价格
    def jiage(self):
        loc=(By.XPATH,'//android.widget.TextView[@resource-id="com.kongfz.app:id/tvName" and @text="价格"]')
        ele=self.find_ele(loc)
        return ele
    # 价格排序
    def jiapai(self):
        loc=(By.XPATH,'//android.widget.TextView[@resource-id="com.kongfz.app:id/tv" and @text="价格从高到低"]')
        ele=self.find_ele(loc)
        return ele
    # 图片
    def tu(self):
        loc = (By.XPATH,'(//android.widget.ImageView[@resource-id="com.kongfz.app:id/ivPic"])[7]')
        ele=self.find_ele(loc)
        return ele
    # 加购物车
    def jiagou(self):
        loc=(By.ID,'com.kongfz.app:id/tvAddCart1')
        ele=self.find_ele(loc)
        return ele
    # 进入购物车
    def jingou(self):
        loc=(By.ID,'com.kongfz.app:id/tvCartT')
        ele=self.find_ele(loc)
        return ele
    def duanyan(self):
        loc=(By.ID,'com.kongfz.app:id/tv_cart_name')
        ele=self.find_ele(loc)
        return ele